import 'package:FineArt/utils/size_config.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:FineArt/components/text_field_container.dart';
import 'package:FineArt/constants.dart';

class RoundedInputField extends StatelessWidget {
  final String hintText;
  final Widget icon;
  final TextInputType keyType;
  final ValueChanged<String> onChanged;
  final double height;
  final double width;
  final String text;
  final TextEditingController controller;
  const RoundedInputField({
    Key key,
    this.hintText,
    this.keyType,
    this.height=50,
    this.width = 0,
    this.icon,
    this.onChanged,
    this.text,
    this.controller
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    // TextEditingController _controller;
    // if (text!=null && text.isNotEmpty) {
    //   _controller = TextEditingController(text: text);
    // }
    double bottom = 0;
    if (height <50) {
      bottom = getPortraitSHeight(18);
    }
    return TextFieldContainer(
      height: height,
      width: width,
      child: TextField(
        textAlignVertical: TextAlignVertical.center,
        onChanged: onChanged,
        cursorColor: kPrimaryColor,
        keyboardType: keyType,
        controller: controller,
        decoration: InputDecoration(
          // fillColor: Colors.blue,
          // filled: true,
          //contentPadding: EdgeInsets.only(bottom: bottom),
          icon: icon,
          hintText: hintText,
          hintStyle: TextStyle(height: 1,fontSize: setSp(13),color: text_input_hint_color),
          border: InputBorder.none,
          isCollapsed: true
        ),
      ),
    );
  }
}
